module ReportHelper
  
  def vote(eva)
    '<embed src="/flash/vote.swf" flashvars= "high='+eva.high.to_s+'&med='+eva.med.to_s+'&low='+eva.low.to_s+'"type="application/x-shockwave-flash" width="300" height="140"/>'
  end
  
  def title(incumbent, report, company, user, message)
    if incumbent
        "样本详细：" + h(incumbent.title)
    elsif report
        "职位报告：" + h(report.title)
    elsif company
        "公司信息：" + h(company.cname)
    elsif user
        "用户信息：" + h(user.name)
    elsif message
        "站内消息：" + h(message.title)
    end 
  end
  
  def normal(aver=0,sdiv=0,salary=0)
    '<embed  src="/flash/report.swf" flashvars= "aver='+aver.to_s+'&sdiv='+sdiv.to_s+'&salary='+salary.to_s+'"type="application/x-shockwave-flash" width="230" height="188"/>'
  end
  
  
  def reportuser_tag(report)
    unless report.user_id==0
      if  report.User.anonymous==false
        link_to h(report.User.name), :controller=>"view", :action=>"viewuser", :id=>report.User.id
      else
        link_to "匿名用户", :controller=>"view", :action=>"viewuser", :id=>report.User.id
      end
    else
	 "标准报告"
    end
  end
  
    def commenttitle_tag(object)
    if object.class==Company
      text_field 'comment', 'title', :value=>"Re:"+object.name, :style=>"width:300px"
    else
      text_field 'comment', 'title', :value=>"Re:"+object.name, :style=>"width:300px"
    end
  end
  
end
